# -*- coding: latin-1 -*-
from rdflib.graph import ConjunctiveGraph

class RDF:

    #Construtor
    def __init__(self):
        self._graph = ConjunctiveGraph()

    def readTriplesFileNt(self, filesname):
        _graph = ConjunctiveGraph()
        _graph.parse(filesname, format="nt")
        return _graph

    def saveTriplestoreToN3(self, filesname, graph):
        of = open(filesname + ".n3", "wb")
        of.write(graph.serialize(format="n3"))
        of.close()

    def saveTriplestoreToXML(self, filesname, graph):
        of = open(filesname + ".xml", "wb")
        of.write(graph.serialize(format="xml"))
        of.close()

